{load href="__STATIC__/js/layui/layui.js,__STATIC__/js/layui/css/layui.css"}

<form class="layui-form" action="#" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">
            姓名:
        </label>
        <div class="layui-input-block">
            <div class="layui-form-mid " style="color: #0C0C0C;font-size: 20px">{$userinfo.info.name}</div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">
            身份证正面:
        </label>
        <div class="layui-input-block">
            <img src="{$userinfo.info.idcards_front}" alt="身份证正面">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">
            身份证背面:
        </label>
        <div class="layui-input-block">
            <img src="{$userinfo.info.idcards_back}" alt="背面">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">
            营业执照:
        </label>
        <div class="layui-input-block">
            <img src="{$userinfo.info.license}" alt="背面">
        </div>
    </div>

    <input type="text" style="display: none" name="id" value="{$userinfo.id}">

    <div class="layui-form-item">
        <div class="layui-input-block">
            {if ( $userinfo.status == 2)}
                <button class="layui-btn layui-btn-normal" lay-submit lay-filter="examine">通过实名认证</button>
            {else /}
                <button class="layui-btn layui-btn-normal layui-btn-disabled" lay-submit>已认证</button>
            {/if}
        </div>
    </div>
</form>

<script>
    layui.use(['form','layer','jquery'],function () {
        var layer = layui.layer
            ,$ = layui.jquery
            ,form = layui.form;

        //监听提交
        form.on('submit(examine)', function(data) {
            $.ajax({
                url:"{:url('examine')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function (res) {
                    if(res.code == 1){
                        layer.msg('未知错误');
                    }else {
                        layer.msg('实名认证通过');
                        location.reload();
                    }
                }

            })
        });
    })
</script>